import time
from functools import partial
from threading import Thread


def output(content):
    while True:
        print(content, end='', flush=True)
        time.sleep(0.01)


# 偏函数：基于已有的函数，确定其中一个或多个参数来生成新的函数的方法
output1 = partial(output, content='Ping')
# output2 = partial(output, content='Pong')


def main():
    t1 = Thread(target=output1, daemon=True)
    t1.start()
    t2 = Thread(target=output, args=('Pong', ), daemon=True)
    t2.start()
    time.sleep(3)


if __name__ == '__main__':
    main()
